package own.stu.jobgib.playown.juc.activeObject.service;

import own.stu.jobgib.playown.juc.activeObject.result.RealResult;
import own.stu.jobgib.playown.juc.activeObject.result.Result;

public class Servant implements ActiveObject {
    @Override
    public Result<String> makeString(int count, char fillChar) {
        char[] cs = new char[count];
        for (int i = 0; i < count; i++) {
            cs[i] = fillChar;
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
            }
        }
        return new RealResult<>(new String(cs));
    }

    @Override
    public void displayString(String string) {
        System.out.println("displayString: " + string);
        try {
            Thread.sleep(10);
        } catch (InterruptedException e) {
        }

        class Requestss implements Runnable{

            @Override
            public void run() {
                System.out.println(" ;;;; ");
            }
        }
        new Requestss().run();
    }
}
